﻿using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace _069.EFCore
{
	public class BookConfig : IEntityTypeConfiguration<Book>
	{
		public void Configure(EntityTypeBuilder<Book> builder)
		{
			// 对应的表
			builder.ToTable("T_Books");
			// 最大长度 不可为空
			builder.Property(e => e.Title).HasMaxLength(50).IsRequired();
			builder.Property(e => e.AuthorName).HasMaxLength(20).IsRequired();
		}
	}
}
